home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************
-
- FreeMouse V1.0
-
- © 1998,1999 by Alastair M. Robinson
-
- A neat little mouse utility which can adjust the speed of your mouse in
- increments of 1%.
-
- *****************************************************************************/
-
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <exec/io.h>
- #include <exec/interrupts.h>
- #include <exec/ports.h>
- #include <clib/exec_protos.h>
- #include <clib/dos_protos.h>
-
- #include "GUI.h"
- #include "Cx.h"
- #include "Icon.h"
-
- struct IntuitionBase *IntuitionBase;
- void *GfxBase, *GadToolsBase, *LayersBase, *IconBase;
-
- char *Main_Setup();
- void Main_Cleanup();
-
- struct CxContext *Cx;
- struct GUIContext *GUI;
-
- int main()
- {
- char *error;
- int i;
- BOOL cont;
-
- if(!(error=Main_Setup()))
- {
- PutStr("Everything setup OK!\n");
- if(MatchToolType("CX_POPUP","YES"))
- GUI->Show(GUI);
- do
- {
- unsigned long sigs;
- sigs=GUI->Signals|Cx->Signals;
- sigs=Wait(sigs);
- cont=GUI->Handle(GUI,sigs);
- cont&=Cx->Handle(Cx,sigs);
- } while(cont);
- }
- else
- {
- PutStr(error); PutStr("\n");
- }
- Main_Cleanup();
- return(0);
- }
-
-
- char *Main_Setup()
- {
- char *error;
-
- if(!(IconBase=OpenLibrary("icon.library",0)))
- return("Can't open Icon library!");
- if(!(GadToolsBase=OpenLibrary("gadtools.library",0)))
- return("Can't open Gadtools library!");
- if(!(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0)))
- return("Can't open Intuition library!");
- if(!(GfxBase=OpenLibrary("graphics.library",0)))
- return("Can't open Graphics library!");
- if(!(LayersBase=OpenLibrary("layers.library",0)))
- return("Can't open Layers library!");
-
- if(!Icon_Setup())
- return("Problems with Icon!");
-
- if(!Commodities_Setup())
- return("Can't open commodities.library");
-
- if(!(GUI=CreateGUI()))
- return("Can't create GUI!");
-
- if(!(Cx=CreateCxContext(GUI)))
- return("Can't create CxContext!");
-
- return(NULL);
- }
-
-
- void Main_Cleanup()
- {
- if(GUI)
- GUI->Dispose(GUI);
- GUI=NULL;
- if(Cx)
- Cx->Dispose(Cx);
- Cx=NULL;
- Commodities_Cleanup();
- Icon_Cleanup();
-
- if(GadToolsBase)
- CloseLibrary(GadToolsBase);
- GadToolsBase=NULL;
- if(GfxBase)
- CloseLibrary(GfxBase);
- GfxBase=NULL;
- if(IntuitionBase)
- CloseLibrary((struct Library *)IntuitionBase);
- IntuitionBase=NULL;
- if(LayersBase)
- CloseLibrary(LayersBase);
- LayersBase=NULL;
- if(IconBase)
- CloseLibrary(IconBase);
- IconBase=NULL;
- }
-
-
-